package it.polimi.swimv2.remote;

import java.util.Collection;

import it.polimi.swimv2.entities.FriendshipRequest;
import it.polimi.swimv2.exception.FriendshipRequestException;

import javax.ejb.Remote;

@Remote
public interface FriendshipRequestManagerRemote {
	
	/**
	 * Returns the received friendship request of the specified user
	 * 
	 * @param username
	 * @return the received friendship requests
	 * @throws FriendshipRequestException
	 */
	public Collection<FriendshipRequest> receivedFriendshipRequest(
			String username) throws FriendshipRequestException;

	/**
	 * Returns the sent requests of the specified request.
	 * 
	 * @param username
	 * @return the sent requests
	 * @throws FriendshipRequestException
	 *             when parameter are not valid
	 */
	public Collection<FriendshipRequest> sentFriendshipRequest(String username)
			throws FriendshipRequestException;

	/**
	 * 
	 * @param username
	 * @param friendshipId
	 * @return
	 * @throws FriendshipRequestException
	 */
	public boolean acceptFriendship(String username, Integer friendshipId)
			throws FriendshipRequestException;

	/**
	 * 
	 * @param username
	 * @param friendshipId
	 * @return
	 * @throws FriendshipRequestException
	 *             when parameter are not valid or the request is not pending
	 */
	public boolean refuseFriendship(String username, Integer friendshipId)
			throws FriendshipRequestException;

	/**
	 * Deletes a pending friendship request.
	 * 
	 * @param username
	 * @param friendshipId
	 * @return
	 * @throws FriendshipRequestException
	 *             when parameter are not valid or the request is not pending
	 */
	public boolean deleteFriendship(String username, Integer friendshipId)
			throws FriendshipRequestException;

	/**
	 * Sends a friendship request.
	 * 
	 * @param sender
	 * @param receiver
	 * @return
	 * @throws FriendshipRequestException
	 */
	public boolean sendFriendshipRequest(String sender, String receiver)
			throws FriendshipRequestException;
}
